
function payoff = Payoffs(x,gamma,B,X,C,xi,p,M)

if p~=3 && p~=4 % MP, NA, or PAN candidate
    payoff = - gamma(p,1) * LogShares(x,B,X,C,xi,p) + x;
else
    if M == 0 % independent PRI or PVEM candidate
        payoff = - gamma(p,1) * LogShares(x,B,X,C,xi,p) + x;
    else % joint PRI-PVEM candidate
        payoff = - (gamma(3,1) + gamma(4,1)) * LogShares(x,B,X,C,xi,p) + x;
    end
end



